import Vue from 'vue'

import Router from 'vue-router'

import Login from '@/views/Login.vue'
import Home from '@/views/Home.vue'
import Welcome from '@/views/welcome/Welcome.vue'
import User from '@/views/user/User.vue'
import Rights from '@/views/rights/Rights.vue'
import Roles from '@/views/rights/Roles.vue'


Vue.use(Router)

export default new Router({
    routes: [{
            path: '/login',
            name: 'Login',
            component: Login
        },
        {
            path: '/',
            name: 'Home',
            component: Home,
            // redirect: { path: 'welcome' }-------{redirect: '/welcome'}-----路由重定向的两种写法
            redirect: '/welcome',
            children: [{ //子路由有多个,是个数组,子路由后面无须加/
                    path: 'welcome',
                    name: 'Welcome',
                    component: Welcome
                },
                {
                    path: 'user',
                    name: 'User',
                    component: User
                },
                {
                    path: '/rights',
                    name: 'Rights',
                    component: Rights
                },
                {
                    path: '/roles',
                    name: 'Roles',
                    component: Roles
                }
            ]
        }


    ]
})